package com.ruoyi.develop.finance.financeGoodsRunAccount.service.impl;

import java.util.List;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.DateUtils;
        import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.ruoyi.develop.finance.financeGoodsRunAccount.mapper.FinanceGoodsRunAccountMapper;
import com.ruoyi.develop.finance.financeGoodsRunAccount.domain.FinanceGoodsRunAccount;
import com.ruoyi.develop.finance.financeGoodsRunAccount.service.IFinanceGoodsRunAccountService;

/**
 * 库存商品流水账Service业务层处理
 * @author lmm
 * @date 2025-08-14
 */
@Service
public class FinanceGoodsRunAccountServiceImpl implements IFinanceGoodsRunAccountService {
    @Resource
    private FinanceGoodsRunAccountMapper financeGoodsRunAccountMapper;

    /**
     * 查询库存商品流水账
     * @param id 库存商品流水账主键
     * @return 库存商品流水账
     */
    @Override
    public FinanceGoodsRunAccount selectById(String id) {
        return financeGoodsRunAccountMapper.selectById(id);
    }

    /**
     * 查询库存商品流水账列表
     * @param entity 库存商品流水账
     * @return 库存商品流水账
     */
    @Override
    public List<FinanceGoodsRunAccount> selectList(FinanceGoodsRunAccount entity) {
        return financeGoodsRunAccountMapper.selectList(entity);
    }

    /**
     * 新增库存商品流水账
     * @param entity 库存商品流水账
     * @return 结果
     */
    @Override
    public int insert(FinanceGoodsRunAccount entity) {
        if(StringUtils.isBlank(entity.getId())){
            entity.setId(IdUtils.fastSimpleUUID());
        }
                entity.setCreateBy(SecurityUtils.getUsername());
                entity.setCreateTime(DateUtils.getNowDate());
            return financeGoodsRunAccountMapper.insert(entity);
    }

    /**
     * 修改库存商品流水账
     * @param entity 库存商品流水账
     * @return 结果
     */
    @Override
    public int update(FinanceGoodsRunAccount entity) {
                entity.setUpdateBy(SecurityUtils.getUsername());
                entity.setUpdateTime(DateUtils.getNowDate());
        return financeGoodsRunAccountMapper.update(entity);
    }

    /**
     * 批量删除库存商品流水账
     * @param ids 需要删除的库存商品流水账主键
     * @return 结果
     */
    @Override
    public int deleteByIds(String[] ids) {
        return financeGoodsRunAccountMapper.deleteByIds(ids);
    }

    /**
     * 删除库存商品流水账信息
     * @param id 库存商品流水账主键
     * @return 结果
     */
    @Override
    public int deleteById(String id) {
        return financeGoodsRunAccountMapper.deleteById(id);
    }
}
